<?php

session_start();


require_once 'include/config.lib.php';
require_once 'include/database.lib.php';

	$paperUrl = (String)$_GET['url'];
	
	ConnectToDB();
	$selectid = DBExecute("SELECT bibtexid as id FROM Resource WHERE url = ?", $paperUrl);
	if($id = $selectid->fetchAssocRow()){//find the person's id to redirect to the person's own page
		if(isset($id['ID']) && $id['ID']!=null)
			$url = "paper_view.php?id=".$id["ID"];
		else		
			$url = "index.php";
	}
	else{
		$url = "index.php";
	}
	echo "<HTML><META http-equiv=\"refresh\" content=\"0; url='".$url."'\"></HTML>";//redirect to the person's profile page or homepage if user not valid
?>